#!/usr/bin/python
# -*- coding : UTF-8 -*-
# ========================
# @Time  : 2020/7/28 17:55
# @Author: Mecell
# @File  : training_mysql.py
# ========================
import random

from common.mysql_packaging import MysqlHandle
from common.config_packaging import ConfigHandle
from common.path_constants import TRAINING_SQL_CONF

class TrainingMysql(MysqlHandle):
    """
    定义处理培训管理MySQL处理的类
    """

    training_sql_conf = ConfigHandle(TRAINING_SQL_CONF)

    def get_com_course_info(self):
        """
        获取公司课程信息
        :return:
        """
        com_course_sql = self.training_sql_conf("com_course", "com_course_info")
        com_course_info = self(com_course_sql)
        return com_course_info

    def get_case_info(self):
        """
        获取案例信息
        :return:
        """
        case_sql = self.training_sql_conf("com_course", "case_info")
        case_info = self(case_sql)
        return case_info

    def get_dep_course_info(self):
        """
        获取部门课程信息
        :return:
        """
        dep_course_sql = self.training_sql_conf("dep_course", "dep_course_info")
        dep_course_info = self(dep_course_sql)
        return dep_course_info

    def get_dep_test_course_id(self,test_flag):
        """
        获取部门课程是否配备试卷课程id
        :return:
        """
        dep_test_course_sql = self.training_sql_conf("dep_course", "dep_test_course_id")
        dep_test_course_id = self(dep_test_course_sql,args=(test_flag,))
        return dep_test_course_id




if __name__ == '__main__':
    training_mysql = TrainingMysql()
    # print(training_mysql.get_com_course_info())
    print(training_mysql.get_dep_test_course_id(0))
